package cn.edu.bjtu.toychange.entity;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.math.BigInteger;
import java.util.List;


/**
 * The persistent class for the user database table.
 * 
 */
@Entity
//@NamedQuery(name="User.findAll", query="SELECT u FROM User u")
public class User implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int u_userID;

	private String u_address;

	private int u_credit;

	private byte u_gender;

	private byte u_islocked;

	private String u_password;

	private BigInteger u_phone;

	private byte u_power;

	@Column(name="U_QQ")
	private int uQq;

	private int u_rate;

	@Temporal(TemporalType.DATE)
	private Date u_registerTime;

	@Lob
	private byte[] u_userImage;

	private String u_userName;

	//bi-directional many-to-one association to Message
	@OneToMany(mappedBy="user1")
	private List<Message> messages1;

	//bi-directional many-to-one association to Message
	@OneToMany(mappedBy="user2")
	private List<Message> messages2;

	//bi-directional many-to-one association to Requisition
	@OneToMany(mappedBy="user1")
	private List<Requisition> requisitions1;

	//bi-directional many-to-one association to Requisition
	@OneToMany(mappedBy="user2")
	private List<Requisition> requisitions2;

	//bi-directional many-to-one association to Toy
	@OneToMany(mappedBy="user")
	private List<Toy> toys;

	//bi-directional many-to-one association to Transrecord
	@OneToMany(mappedBy="user1")
	private List<TransRecord> transrecords1;

	//bi-directional many-to-one association to Transrecord
	@OneToMany(mappedBy="user2")
	private List<TransRecord> transrecords2;

	public User() {
	}

	public int getU_userID() {
		return this.u_userID;
	}

	public void setU_userID(int u_userID) {
		this.u_userID = u_userID;
	}

	public String getU_address() {
		return this.u_address;
	}

	public void setU_address(String u_address) {
		this.u_address = u_address;
	}

	public int getU_credit() {
		return this.u_credit;
	}

	public void setU_credit(int u_credit) {
		this.u_credit = u_credit;
	}

	public byte getU_gender() {
		return this.u_gender;
	}

	public void setU_gender(byte u_gender) {
		this.u_gender = u_gender;
	}

	public byte getU_islocked() {
		return this.u_islocked;
	}

	public void setU_islocked(byte u_islocked) {
		this.u_islocked = u_islocked;
	}

	public String getU_password() {
		return this.u_password;
	}

	public void setU_password(String u_password) {
		this.u_password = u_password;
	}

	public BigInteger getU_phone() {
		return this.u_phone;
	}

	public void setU_phone(BigInteger u_phone) {
		this.u_phone = u_phone;
	}

	public byte getU_power() {
		return this.u_power;
	}

	public void setU_power(byte u_power) {
		this.u_power = u_power;
	}

	public int getUQq() {
		return this.uQq;
	}

	public void setUQq(int uQq) {
		this.uQq = uQq;
	}

	public int getU_rate() {
		return this.u_rate;
	}

	public void setU_rate(int u_rate) {
		this.u_rate = u_rate;
	}

	public Date getU_registerTime() {
		return this.u_registerTime;
	}

	public void setU_registerTime(Date u_registerTime) {
		this.u_registerTime = u_registerTime;
	}

	public byte[] getU_userImage() {
		return this.u_userImage;
	}

	public void setU_userImage(byte[] u_userImage) {
		this.u_userImage = u_userImage;
	}

	public String getU_userName() {
		return this.u_userName;
	}

	public void setU_userName(String u_userName) {
		this.u_userName = u_userName;
	}

	public List<Message> getMessages1() {
		return this.messages1;
	}

	public void setMessages1(List<Message> messages1) {
		this.messages1 = messages1;
	}

	public Message addMessages1(Message messages1) {
		getMessages1().add(messages1);
		messages1.setUser1(this);

		return messages1;
	}

	public Message removeMessages1(Message messages1) {
		getMessages1().remove(messages1);
		messages1.setUser1(null);

		return messages1;
	}

	public List<Message> getMessages2() {
		return this.messages2;
	}

	public void setMessages2(List<Message> messages2) {
		this.messages2 = messages2;
	}

	public Message addMessages2(Message messages2) {
		getMessages2().add(messages2);
		messages2.setUser2(this);

		return messages2;
	}

	public Message removeMessages2(Message messages2) {
		getMessages2().remove(messages2);
		messages2.setUser2(null);

		return messages2;
	}

	public List<Requisition> getRequisitions1() {
		return this.requisitions1;
	}

	public void setRequisitions1(List<Requisition> requisitions1) {
		this.requisitions1 = requisitions1;
	}

	public Requisition addRequisitions1(Requisition requisitions1) {
		getRequisitions1().add(requisitions1);
		requisitions1.setUser1(this);

		return requisitions1;
	}

	public Requisition removeRequisitions1(Requisition requisitions1) {
		getRequisitions1().remove(requisitions1);
		requisitions1.setUser1(null);

		return requisitions1;
	}

	public List<Requisition> getRequisitions2() {
		return this.requisitions2;
	}

	public void setRequisitions2(List<Requisition> requisitions2) {
		this.requisitions2 = requisitions2;
	}

	public Requisition addRequisitions2(Requisition requisitions2) {
		getRequisitions2().add(requisitions2);
		requisitions2.setUser2(this);

		return requisitions2;
	}

	public Requisition removeRequisitions2(Requisition requisitions2) {
		getRequisitions2().remove(requisitions2);
		requisitions2.setUser2(null);

		return requisitions2;
	}

	public List<Toy> getToys() {
		return this.toys;
	}

	public void setToys(List<Toy> toys) {
		this.toys = toys;
	}

	public Toy addToy(Toy toy) {
		getToys().add(toy);
		toy.setUser(this);

		return toy;
	}

	public Toy removeToy(Toy toy) {
		getToys().remove(toy);
		toy.setUser(null);

		return toy;
	}

	public List<TransRecord> getTransrecords1() {
		return this.transrecords1;
	}

	public void setTransrecords1(List<TransRecord> transrecords1) {
		this.transrecords1 = transrecords1;
	}

	public TransRecord addTransrecords1(TransRecord transrecords1) {
		getTransrecords1().add(transrecords1);
		transrecords1.setUser1(this);

		return transrecords1;
	}

	public TransRecord removeTransrecords1(TransRecord transrecords1) {
		getTransrecords1().remove(transrecords1);
		transrecords1.setUser1(null);

		return transrecords1;
	}

	public List<TransRecord> getTransrecords2() {
		return this.transrecords2;
	}

	public void setTransrecords2(List<TransRecord> transrecords2) {
		this.transrecords2 = transrecords2;
	}

	public TransRecord addTransrecords2(TransRecord transrecords2) {
		getTransrecords2().add(transrecords2);
		transrecords2.setUser2(this);

		return transrecords2;
	}

	public TransRecord removeTransrecords2(TransRecord transrecords2) {
		getTransrecords2().remove(transrecords2);
		transrecords2.setUser2(null);

		return transrecords2;
	}

}